import { cloneDeep } from 'lodash';

export const autoMap = <S, T>(
  source: S,
  target: T,
  excludeProp?: (keyof S)[],
) => {
  Object.keys(target).forEach(_ => {
    if (excludeProp && excludeProp.includes(_ as any)) return;
    target[_] = cloneDeep(source[_]);
  });
};
